package view;

import java.awt.EventQueue;

import javax.swing.JFrame;
import java.awt.GridBagLayout;
import javax.swing.JLabel;

import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JButton;
import javax.swing.SwingConstants;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import model.StringFactory;

import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.JSeparator;

import control.Control;

public class MainView {

	private JFrame frmLcsEvaluator;
	private JTextField textFieldA;
	private JTextField textFieldB;
	private final ButtonGroup buttonGroupProblem = new ButtonGroup();
	

	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainView window = new MainView();
					window.frmLcsEvaluator.pack();
					window.frmLcsEvaluator.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public MainView() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmLcsEvaluator = new JFrame();
		frmLcsEvaluator.setTitle("LCS Evaluator");
		frmLcsEvaluator.setBounds(100, 100, 1098, 526);
		frmLcsEvaluator.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
		frmLcsEvaluator.getContentPane().setLayout(gridBagLayout);
		
		JSeparator separator_2 = new JSeparator();
		GridBagConstraints gbc_separator_2 = new GridBagConstraints();
		gbc_separator_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_separator_2.insets = new Insets(0, 0, 5, 5);
		gbc_separator_2.gridx = 3;
		gbc_separator_2.gridy = 0;
		frmLcsEvaluator.getContentPane().add(separator_2, gbc_separator_2);
		
		JLabel lblProblems = new JLabel("Problem(s)");
		GridBagConstraints gbc_lblProblems = new GridBagConstraints();
		gbc_lblProblems.anchor = GridBagConstraints.WEST;
		gbc_lblProblems.insets = new Insets(0, 0, 5, 5);
		gbc_lblProblems.gridx = 1;
		gbc_lblProblems.gridy = 1;
		frmLcsEvaluator.getContentPane().add(lblProblems, gbc_lblProblems);
		
		JSeparator separator = new JSeparator();
		GridBagConstraints gbc_separator = new GridBagConstraints();
		gbc_separator.insets = new Insets(0, 0, 5, 5);
		gbc_separator.gridx = 0;
		gbc_separator.gridy = 2;
		frmLcsEvaluator.getContentPane().add(separator, gbc_separator);
		
		JRadioButton rdbtnProvidedStrings = new JRadioButton("Provided strings");

		rdbtnProvidedStrings.setSelected(true);
		rdbtnProvidedStrings.setActionCommand("1");
		buttonGroupProblem.add(rdbtnProvidedStrings);
		GridBagConstraints gbc_rdbtnProvidedStrings = new GridBagConstraints();
		gbc_rdbtnProvidedStrings.anchor = GridBagConstraints.WEST;
		gbc_rdbtnProvidedStrings.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnProvidedStrings.gridx = 1;
		gbc_rdbtnProvidedStrings.gridy = 2;
		frmLcsEvaluator.getContentPane().add(rdbtnProvidedStrings, gbc_rdbtnProvidedStrings);
		
		JRadioButton rdbtnRandomStrings = new JRadioButton("Random strings");
		
		rdbtnRandomStrings.setActionCommand("2");
		buttonGroupProblem.add(rdbtnRandomStrings);
		GridBagConstraints gbc_rdbtnRandomStrings = new GridBagConstraints();
		gbc_rdbtnRandomStrings.anchor = GridBagConstraints.WEST;
		gbc_rdbtnRandomStrings.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnRandomStrings.gridx = 2;
		gbc_rdbtnRandomStrings.gridy = 2;
		frmLcsEvaluator.getContentPane().add(rdbtnRandomStrings, gbc_rdbtnRandomStrings);
		
		JRadioButton rdbtnRandomStringsgrowing = new JRadioButton("Random strings (growing lenght)");
		
		rdbtnRandomStringsgrowing.setActionCommand("3");
		buttonGroupProblem.add(rdbtnRandomStringsgrowing);
		GridBagConstraints gbc_rdbtnRandomStringsgrowing = new GridBagConstraints();
		gbc_rdbtnRandomStringsgrowing.anchor = GridBagConstraints.WEST;
		gbc_rdbtnRandomStringsgrowing.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnRandomStringsgrowing.gridx = 3;
		gbc_rdbtnRandomStringsgrowing.gridy = 2;
		frmLcsEvaluator.getContentPane().add(rdbtnRandomStringsgrowing, gbc_rdbtnRandomStringsgrowing);
		
		JRadioButton rdbtnRandomProteins = new JRadioButton("Random proteins");

		rdbtnRandomProteins.setActionCommand("4");
		buttonGroupProblem.add(rdbtnRandomProteins);
		GridBagConstraints gbc_rdbtnRandomProteins = new GridBagConstraints();
		gbc_rdbtnRandomProteins.anchor = GridBagConstraints.WEST;
		gbc_rdbtnRandomProteins.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnRandomProteins.gridx = 4;
		gbc_rdbtnRandomProteins.gridy = 2;
		frmLcsEvaluator.getContentPane().add(rdbtnRandomProteins, gbc_rdbtnRandomProteins);
		
		JRadioButton rdbtnNewRadioButton = new JRadioButton("Random words");

		rdbtnNewRadioButton.setActionCommand("5");
		buttonGroupProblem.add(rdbtnNewRadioButton);
		GridBagConstraints gbc_rdbtnNewRadioButton = new GridBagConstraints();
		gbc_rdbtnNewRadioButton.anchor = GridBagConstraints.WEST;
		gbc_rdbtnNewRadioButton.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnNewRadioButton.gridx = 5;
		gbc_rdbtnNewRadioButton.gridy = 2;
		frmLcsEvaluator.getContentPane().add(rdbtnNewRadioButton, gbc_rdbtnNewRadioButton);
		
		JRadioButton rdbtnRandomSentences = new JRadioButton("Random sentences");
		
		rdbtnRandomSentences.setActionCommand("6");
		buttonGroupProblem.add(rdbtnRandomSentences);
		GridBagConstraints gbc_rdbtnRandomSentences = new GridBagConstraints();
		gbc_rdbtnRandomSentences.anchor = GridBagConstraints.WEST;
		gbc_rdbtnRandomSentences.insets = new Insets(0, 0, 5, 0);
		gbc_rdbtnRandomSentences.gridx = 6;
		gbc_rdbtnRandomSentences.gridy = 2;
		frmLcsEvaluator.getContentPane().add(rdbtnRandomSentences, gbc_rdbtnRandomSentences);
		
		JPanel panel = new JPanel();
		GridBagConstraints gbc_panel = new GridBagConstraints();
		gbc_panel.insets = new Insets(0, 0, 5, 5);
		gbc_panel.fill = GridBagConstraints.HORIZONTAL;
		gbc_panel.gridx = 1;
		gbc_panel.gridy = 3;
		frmLcsEvaluator.getContentPane().add(panel, gbc_panel);
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{0, 0, 0};
		gbl_panel.rowHeights = new int[]{0, 0, 0};
		gbl_panel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
		gbl_panel.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
		panel.setLayout(gbl_panel);
		
		final JLabel lblA = new JLabel("A : ");
		GridBagConstraints gbc_lblA = new GridBagConstraints();
		gbc_lblA.insets = new Insets(0, 0, 5, 5);
		gbc_lblA.anchor = GridBagConstraints.EAST;
		gbc_lblA.gridx = 0;
		gbc_lblA.gridy = 0;
		panel.add(lblA, gbc_lblA);
		
		textFieldA = new JTextField();
		GridBagConstraints gbc_textFieldA = new GridBagConstraints();
		gbc_textFieldA.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldA.insets = new Insets(0, 0, 5, 0);
		gbc_textFieldA.gridx = 1;
		gbc_textFieldA.gridy = 0;
		panel.add(textFieldA, gbc_textFieldA);
		textFieldA.setColumns(10);
		
		final JLabel lblB = new JLabel("B : ");
		GridBagConstraints gbc_lblB = new GridBagConstraints();
		gbc_lblB.anchor = GridBagConstraints.EAST;
		gbc_lblB.insets = new Insets(0, 0, 0, 5);
		gbc_lblB.gridx = 0;
		gbc_lblB.gridy = 1;
		panel.add(lblB, gbc_lblB);
		
		textFieldB = new JTextField();
		GridBagConstraints gbc_textFieldB = new GridBagConstraints();
		gbc_textFieldB.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldB.gridx = 1;
		gbc_textFieldB.gridy = 1;
		panel.add(textFieldB, gbc_textFieldB);
		textFieldB.setColumns(10);
		
		JPanel panel_2 = new JPanel();
		GridBagConstraints gbc_panel_2 = new GridBagConstraints();
		gbc_panel_2.insets = new Insets(0, 0, 5, 5);
		gbc_panel_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_panel_2.gridx = 2;
		gbc_panel_2.gridy = 3;
		frmLcsEvaluator.getContentPane().add(panel_2, gbc_panel_2);
		GridBagLayout gbl_panel_2 = new GridBagLayout();
		gbl_panel_2.columnWidths = new int[]{0, 0, 0};
		gbl_panel_2.rowHeights = new int[]{0, 0};
		gbl_panel_2.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
		gbl_panel_2.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel_2.setLayout(gbl_panel_2);
		
		final JLabel lblLenght = new JLabel("Lenght : ");
		lblLenght.setEnabled(false);
		GridBagConstraints gbc_lblLenght = new GridBagConstraints();
		gbc_lblLenght.insets = new Insets(0, 0, 0, 5);
		gbc_lblLenght.anchor = GridBagConstraints.EAST;
		gbc_lblLenght.gridx = 0;
		gbc_lblLenght.gridy = 0;
		panel_2.add(lblLenght, gbc_lblLenght);
		
		final JSpinner spinnerLenght = new JSpinner();
		spinnerLenght.setEnabled(false);
		spinnerLenght.setModel(new SpinnerNumberModel(0, 0, 10000, 1));
		GridBagConstraints gbc_spinnerLenght = new GridBagConstraints();
		gbc_spinnerLenght.anchor = GridBagConstraints.WEST;
		gbc_spinnerLenght.gridx = 1;
		gbc_spinnerLenght.gridy = 0;
		panel_2.add(spinnerLenght, gbc_spinnerLenght);
		
		JPanel panel_1 = new JPanel();
		GridBagConstraints gbc_panel_1 = new GridBagConstraints();
		gbc_panel_1.insets = new Insets(0, 0, 5, 5);
		gbc_panel_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_panel_1.gridx = 3;
		gbc_panel_1.gridy = 3;
		frmLcsEvaluator.getContentPane().add(panel_1, gbc_panel_1);
		GridBagLayout gbl_panel_1 = new GridBagLayout();
		gbl_panel_1.columnWidths = new int[]{0, 0, 0};
		gbl_panel_1.rowHeights = new int[]{0, 0};
		gbl_panel_1.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
		gbl_panel_1.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel_1.setLayout(gbl_panel_1);
		
		final JLabel lblMaxLenght = new JLabel("Max lenght : ");
		lblMaxLenght.setEnabled(false);
		GridBagConstraints gbc_lblMaxLenght = new GridBagConstraints();
		gbc_lblMaxLenght.insets = new Insets(0, 0, 0, 5);
		gbc_lblMaxLenght.anchor = GridBagConstraints.EAST;
		gbc_lblMaxLenght.gridx = 0;
		gbc_lblMaxLenght.gridy = 0;
		panel_1.add(lblMaxLenght, gbc_lblMaxLenght);
		
		final JSpinner spinnerMaxLenght = new JSpinner();
		spinnerMaxLenght.setEnabled(false);
		spinnerMaxLenght.setModel(new SpinnerNumberModel(0, 0, 10000, 1));
		GridBagConstraints gbc_spinnerMaxLenght = new GridBagConstraints();
		gbc_spinnerMaxLenght.anchor = GridBagConstraints.WEST;
		gbc_spinnerMaxLenght.gridx = 1;
		gbc_spinnerMaxLenght.gridy = 0;
		panel_1.add(spinnerMaxLenght, gbc_spinnerMaxLenght);
		
		JPanel panel_3 = new JPanel();
		GridBagConstraints gbc_panel_3 = new GridBagConstraints();
		gbc_panel_3.insets = new Insets(0, 0, 5, 0);
		gbc_panel_3.fill = GridBagConstraints.HORIZONTAL;
		gbc_panel_3.gridx = 6;
		gbc_panel_3.gridy = 3;
		frmLcsEvaluator.getContentPane().add(panel_3, gbc_panel_3);
		GridBagLayout gbl_panel_3 = new GridBagLayout();
		gbl_panel_3.columnWidths = new int[]{0, 0, 0};
		gbl_panel_3.rowHeights = new int[]{0, 0};
		gbl_panel_3.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
		gbl_panel_3.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel_3.setLayout(gbl_panel_3);
		
		final JLabel lblNbOfWords = new JLabel("Nb of words :");
		lblNbOfWords.setEnabled(false);
		GridBagConstraints gbc_lblNbOfWords = new GridBagConstraints();
		gbc_lblNbOfWords.insets = new Insets(0, 0, 0, 5);
		gbc_lblNbOfWords.anchor = GridBagConstraints.EAST;
		gbc_lblNbOfWords.gridx = 0;
		gbc_lblNbOfWords.gridy = 0;
		panel_3.add(lblNbOfWords, gbc_lblNbOfWords);
		
		final JSpinner spinnerNbWords = new JSpinner();
		spinnerNbWords.setEnabled(false);
		spinnerNbWords.setModel(new SpinnerNumberModel(0, 0, 1000, 1));
		GridBagConstraints gbc_spinnerNbWords = new GridBagConstraints();
		gbc_spinnerNbWords.anchor = GridBagConstraints.WEST;
		gbc_spinnerNbWords.gridx = 1;
		gbc_spinnerNbWords.gridy = 0;
		panel_3.add(spinnerNbWords, gbc_spinnerNbWords);
		
		JSeparator separator_1 = new JSeparator();
		GridBagConstraints gbc_separator_1 = new GridBagConstraints();
		gbc_separator_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_separator_1.insets = new Insets(0, 0, 5, 5);
		gbc_separator_1.gridx = 3;
		gbc_separator_1.gridy = 4;
		frmLcsEvaluator.getContentPane().add(separator_1, gbc_separator_1);
		
		JLabel lblSelectAlgorithmTo = new JLabel("Algorithm(s)");
		GridBagConstraints gbc_lblSelectAlgorithmTo = new GridBagConstraints();
		gbc_lblSelectAlgorithmTo.anchor = GridBagConstraints.WEST;
		gbc_lblSelectAlgorithmTo.insets = new Insets(0, 0, 5, 5);
		gbc_lblSelectAlgorithmTo.gridx = 1;
		gbc_lblSelectAlgorithmTo.gridy = 5;
		frmLcsEvaluator.getContentPane().add(lblSelectAlgorithmTo, gbc_lblSelectAlgorithmTo);
		
		JCheckBox chckbxDynamic = new JCheckBox("Dynamic");

		chckbxDynamic.setSelected(true);
		GridBagConstraints gbc_chckbxDynamic = new GridBagConstraints();
		gbc_chckbxDynamic.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamic.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamic.gridx = 1;
		gbc_chckbxDynamic.gridy = 6;
		frmLcsEvaluator.getContentPane().add(chckbxDynamic, gbc_chckbxDynamic);
		
		JCheckBox chckbxDynamicApprox = new JCheckBox("Dynamic Approx 1");
		GridBagConstraints gbc_chckbxDynamicApprox = new GridBagConstraints();
		gbc_chckbxDynamicApprox.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicApprox.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamicApprox.gridx = 2;
		gbc_chckbxDynamicApprox.gridy = 6;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicApprox, gbc_chckbxDynamicApprox);
		
		JCheckBox chckbxDynamicApprox_1 = new JCheckBox("Dynamic Approx 3");
		GridBagConstraints gbc_chckbxDynamicApprox_1 = new GridBagConstraints();
		gbc_chckbxDynamicApprox_1.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicApprox_1.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamicApprox_1.gridx = 3;
		gbc_chckbxDynamicApprox_1.gridy = 6;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicApprox_1, gbc_chckbxDynamicApprox_1);
		
		JCheckBox chckbxDynamicApprox_2 = new JCheckBox("Dynamic Approx 10");
		GridBagConstraints gbc_chckbxDynamicApprox_2 = new GridBagConstraints();
		gbc_chckbxDynamicApprox_2.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicApprox_2.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamicApprox_2.gridx = 4;
		gbc_chckbxDynamicApprox_2.gridy = 6;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicApprox_2, gbc_chckbxDynamicApprox_2);
		
		JCheckBox chckbxDynamicFreq = new JCheckBox("Dynamic Freq > 5");
		GridBagConstraints gbc_chckbxDynamicFreq = new GridBagConstraints();
		gbc_chckbxDynamicFreq.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicFreq.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamicFreq.gridx = 5;
		gbc_chckbxDynamicFreq.gridy = 6;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicFreq, gbc_chckbxDynamicFreq);
		
		JCheckBox chckbxDynamicFreq_1 = new JCheckBox("Dynamic Freq > 10");
		GridBagConstraints gbc_chckbxDynamicFreq_1 = new GridBagConstraints();
		gbc_chckbxDynamicFreq_1.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicFreq_1.insets = new Insets(0, 0, 5, 0);
		gbc_chckbxDynamicFreq_1.gridx = 6;
		gbc_chckbxDynamicFreq_1.gridy = 6;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicFreq_1, gbc_chckbxDynamicFreq_1);
		
		JCheckBox chckbxDynamicFreq_2 = new JCheckBox("Dynamic Freq 15");
		GridBagConstraints gbc_chckbxDynamicFreq_2 = new GridBagConstraints();
		gbc_chckbxDynamicFreq_2.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicFreq_2.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamicFreq_2.gridx = 1;
		gbc_chckbxDynamicFreq_2.gridy = 7;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicFreq_2, gbc_chckbxDynamicFreq_2);
		
		JCheckBox chckbxDynamicAlea = new JCheckBox("Dynamic Alea 75%");
		GridBagConstraints gbc_chckbxDynamicAlea = new GridBagConstraints();
		gbc_chckbxDynamicAlea.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicAlea.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamicAlea.gridx = 2;
		gbc_chckbxDynamicAlea.gridy = 7;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicAlea, gbc_chckbxDynamicAlea);
		
		JCheckBox chckbxDynamicAlea_1 = new JCheckBox("Dynamic Alea 50%");
		GridBagConstraints gbc_chckbxDynamicAlea_1 = new GridBagConstraints();
		gbc_chckbxDynamicAlea_1.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicAlea_1.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamicAlea_1.gridx = 3;
		gbc_chckbxDynamicAlea_1.gridy = 7;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicAlea_1, gbc_chckbxDynamicAlea_1);
		
		JCheckBox chckbxDynamicAlea_2 = new JCheckBox("Dynamic Alea 25%");
		GridBagConstraints gbc_chckbxDynamicAlea_2 = new GridBagConstraints();
		gbc_chckbxDynamicAlea_2.anchor = GridBagConstraints.WEST;
		gbc_chckbxDynamicAlea_2.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDynamicAlea_2.gridx = 4;
		gbc_chckbxDynamicAlea_2.gridy = 7;
		frmLcsEvaluator.getContentPane().add(chckbxDynamicAlea_2, gbc_chckbxDynamicAlea_2);
		
		JCheckBox chckbxRecursion = new JCheckBox("Recursion");
		GridBagConstraints gbc_chckbxRecursion = new GridBagConstraints();
		gbc_chckbxRecursion.anchor = GridBagConstraints.WEST;
		gbc_chckbxRecursion.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxRecursion.gridx = 5;
		gbc_chckbxRecursion.gridy = 7;
		frmLcsEvaluator.getContentPane().add(chckbxRecursion, gbc_chckbxRecursion);
		
		JCheckBox chckbxBranchAndBound = new JCheckBox("Branch and bound");
		GridBagConstraints gbc_chckbxBranchAndBound = new GridBagConstraints();
		gbc_chckbxBranchAndBound.insets = new Insets(0, 0, 5, 0);
		gbc_chckbxBranchAndBound.anchor = GridBagConstraints.WEST;
		gbc_chckbxBranchAndBound.gridx = 6;
		gbc_chckbxBranchAndBound.gridy = 7;
		frmLcsEvaluator.getContentPane().add(chckbxBranchAndBound, gbc_chckbxBranchAndBound);
		
		rdbtnProvidedStrings.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				spinnerLenght.setEnabled(false);
				spinnerMaxLenght.setEnabled(false);
				spinnerNbWords.setEnabled(false);
				lblLenght.setEnabled(false);
				lblMaxLenght.setEnabled(false);
				lblNbOfWords.setEnabled(false);
				
				lblA.setEnabled(true);
				lblB.setEnabled(true);
				textFieldA.setEnabled(true);
				textFieldB.setEnabled(true);
			}
		});
		
		rdbtnRandomStrings.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				spinnerLenght.setEnabled(true);
				spinnerMaxLenght.setEnabled(false);
				spinnerNbWords.setEnabled(false);
				lblLenght.setEnabled(true);
				lblMaxLenght.setEnabled(false);
				lblNbOfWords.setEnabled(false);
				
				lblA.setEnabled(false);
				lblB.setEnabled(false);
				textFieldA.setEnabled(false);
				textFieldB.setEnabled(false);
			}
		});
		
		rdbtnRandomStringsgrowing.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				
						spinnerLenght.setEnabled(false);
						spinnerMaxLenght.setEnabled(true);
						spinnerNbWords.setEnabled(false);
						lblLenght.setEnabled(false);
						lblMaxLenght.setEnabled(true);
						lblNbOfWords.setEnabled(false);
						
						lblA.setEnabled(false);
						lblB.setEnabled(false);
						textFieldA.setEnabled(false);
						textFieldB.setEnabled(false);
					
				
			}
		});
		
		rdbtnRandomProteins.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				spinnerLenght.setEnabled(false);
				spinnerMaxLenght.setEnabled(false);
				spinnerNbWords.setEnabled(false);
				lblLenght.setEnabled(false);
				lblMaxLenght.setEnabled(false);
				lblNbOfWords.setEnabled(false);
				
				lblA.setEnabled(false);
				lblB.setEnabled(false);
				textFieldA.setEnabled(false);
				textFieldB.setEnabled(false);
			}
		});
		
		rdbtnNewRadioButton.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				spinnerLenght.setEnabled(false);
				spinnerMaxLenght.setEnabled(false);
				spinnerNbWords.setEnabled(false);
				lblLenght.setEnabled(false);
				lblMaxLenght.setEnabled(false);
				lblNbOfWords.setEnabled(false);
				
				lblA.setEnabled(false);
				lblB.setEnabled(false);
				textFieldA.setEnabled(false);
				textFieldB.setEnabled(false);
			}
		});
		
		rdbtnRandomSentences.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				spinnerLenght.setEnabled(false);
				spinnerMaxLenght.setEnabled(false);
				spinnerNbWords.setEnabled(true);
				lblLenght.setEnabled(false);
				lblMaxLenght.setEnabled(false);
				lblNbOfWords.setEnabled(true);
				
				lblA.setEnabled(false);
				lblB.setEnabled(false);
				textFieldA.setEnabled(false);
				textFieldB.setEnabled(false);
			}
		});
		
		JButton btnLaunch = new JButton("Launch");
		btnLaunch.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				
				int problem;
				Boolean[] algo= new Boolean[14];
				String arg1 = null;
				String arg2 = null;

				//for(JCheckBox cb: buttonGroupAlgo.getElements());
				problem = Integer.parseInt(buttonGroupProblem.getSelection().getActionCommand());
				switch (problem) {
				case 1:
					arg1= textFieldA.getText();
					arg2= textFieldB.getText();
					break;
				case 2:
					arg1 =spinnerLenght.getValue().toString();
					break;
				case 3:
					arg1 =spinnerMaxLenght.getValue().toString();
					;
					break;
				case 6:
					arg1 =spinnerNbWords.getValue().toString();
					;
					break;
				}
				JCheckBox cb;
				int i=0;
				for (Component c:frmLcsEvaluator.getContentPane().getComponents()){
					//System.out.println("c");
					if(c.getClass()==JCheckBox.class){
						cb = (JCheckBox) c;
						algo[i]=cb.isSelected();
						i++;
						//System.out.println("cb");						
					}
				}
				

				Control.launch(problem,algo,arg1,arg2);
			}
		});
		
		JCheckBox chckbxDivideAndConquer = new JCheckBox("Divide and conquer");
		GridBagConstraints gbc_chckbxDivideAndConquer = new GridBagConstraints();
		gbc_chckbxDivideAndConquer.anchor = GridBagConstraints.WEST;
		gbc_chckbxDivideAndConquer.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxDivideAndConquer.gridx = 1;
		gbc_chckbxDivideAndConquer.gridy = 8;
		frmLcsEvaluator.getContentPane().add(chckbxDivideAndConquer, gbc_chckbxDivideAndConquer);
		
		JCheckBox chckbxGreedy = new JCheckBox("Greedy");
		GridBagConstraints gbc_chckbxGreedy = new GridBagConstraints();
		gbc_chckbxGreedy.anchor = GridBagConstraints.WEST;
		gbc_chckbxGreedy.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxGreedy.gridx = 2;
		gbc_chckbxGreedy.gridy = 8;
		frmLcsEvaluator.getContentPane().add(chckbxGreedy, gbc_chckbxGreedy);
		GridBagConstraints gbc_btnLaunch = new GridBagConstraints();
		gbc_btnLaunch.insets = new Insets(0, 0, 0, 5);
		gbc_btnLaunch.gridx = 3;
		gbc_btnLaunch.gridy = 9;
		frmLcsEvaluator.getContentPane().add(btnLaunch, gbc_btnLaunch);
	}

}
